<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>XLoadTree API (WebFX)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="webfxlayout.local.js"></script>
</head>
<body>
<!-- WebFX Layout Include -->
<script type="text/javascript">

var articleMenu= new WebFXMenu;
articleMenu.left  = 384;
articleMenu.top   = 86;
articleMenu.width = 140;
articleMenu.add(new WebFXMenuItem("Introduction", "xloadtree.html"));
articleMenu.add(new WebFXMenuItem("Usage", "usage.html"));
articleMenu.add(new WebFXMenuItem("API", "api.html"));
articleMenu.add(new WebFXMenuItem("Implementation", "implementation.html"));
articleMenu.add(new WebFXMenuItem("Demo", "demo.html"));
articleMenu.add(new WebFXMenuSeparator);
articleMenu.add(new WebFXMenuItem("Download", "http://webfx.eae.net/download/xloadtree111.zip"));
webfxMenuBar.add(new WebFXMenuButton("Article Menu", null, null, articleMenu));

webfxLayout.writeTitle("XLoadTree");
webfxLayout.writeMenu();
webfxLayout.writeDesignedByEdger();

</script>
<div class="webfx-main-body">
<!-- end WebFX Layout Includes -->

<h2>WebFXLoadTree</h2>

<p>This object type is used to create the actual tree root and can be used
to populate the tree with tree items loaded from an xml file.</p>

<p>The <code>WebFXLoadTree</code> extends <code>WebFXTree</code> (see the
<a href="/dhtml/xtree/api.html">xTree API</a>) so all properties and methods
provided by <code>WebFXTree</code> are available.</p>

<h3>Constructor</h3>

<pre>new WebFXLoadTree(sText, sXmlSrc, sAction, sBehavior, sIcon, sOpenIcon)</pre>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td>sText</td>
	<td>The text label for the tree root.</td>
</tr>
<tr>
	<td>sXmlSrc</td>
	<td>The source for the xml file to load when expanded.</td>
</tr>
<tr>
	<td>sAction</td>
	<td>Optional. The action (uri) associated with the tree root.</td>
</tr>
<tr>
	<td>sBehavior</td>
	<td>Optional. The behavior of the tree. Valid values are <code>"classic"</code> and
		<code>"explorer"</code>. When the value is set to <code>"explorer"</code>
		the default icon for an empty item is the same as the folder icon.</td>
</tr>
<tr>
	<td>sIcon</td>
	<td>Optional. The icon image to use for this item. In case this item is a folder this
		will be used when the folder is closed.</td>
</tr>
<tr>
	<td>sOpenIcon</td>
	<td>Optional. The icon image to use for this item when it is opened. This is only
		used for folder items that are opened/expanded.</td>
</tr>
</tbody>
</table>

<h3>Properties</h3>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td colspan="2">All properties from <code>WebFXTree</code>.</td>
</tr>
<tr>
	<td>src</td>
	<td>The source to the xml file that decribes the sub trees. Notice that this is
		read-only after the xml file has started to load so any changes done to the
		source are only valid before the loading of the first file.</td>
</tr>
<tr>
	<td>loading</td>
	<td>Read only. A boolean flag which is true if the xml file has started loading and not yet
		finished.</td>
</tr>
<tr>
	<td>loaded</td>
	<td>Read only. A boolean flag which is true if the xml file has been loaded.</td>
</tr>
<tr>
	<td>errorText</td>
	<td>Read only String. If the loading for any reason failed the reason can be found in
		the <code>errorText</code> property. If no error occured this is <code>""</code>
		(an empty string).</td>
</tr>
</tbody>
</table>

<h3>Methods</h3>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td>reload()</td>
	<td>Reloads the XML file from the server and recreates the children of this node.</td>
</tr>
<tr>
	<td colspan="2">All methods from <code>WebFXTree</code>.</td>
</tr>
</tbody>
</table>

<h2>WebFXLoadTreeItem</h2>

<p>This object type is used to create tree items that can be added to the tree
root, or to other tree items to create sub folders in the tree. When an
<code>WebFXLoadTreeItem</code> is expanded an xml file is loaded that is then
used to populate the item with child items.</p>

<p>The <code>WebFXLoadTreeItem</code> extends <code>WebFXTreeItem</code> (see the
<a href="/dhtml/xtree/api.html">xTree API</a>) so all properties and methods
provided by <code>WebFXTreeItem</code> are available.</p>

<h3>Constructor</h3>

<pre>new WebFXLoadTreeItem(sText, sXmlSrc, sAction, eParent, sIcon, sOpenIcon)</pre>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td>sText</td>
	<td>The text label for the tree item.</td>
</tr>
<tr>
	<td>sXmlSrc</td>
	<td>The source for the xml file to load when expanded.</td>
</tr>
<tr>
	<td>sAction</td>
	<td>Optional. The action (uri) associated with the tree item.</td>
</tr>
<tr>
	<td>eParent</td>
	<td>Optional. The parent <code>WebFXTreeItem</code> or <code>WebFXTree</code> that the item
		should be added to.</td>
</tr>
<tr>
	<td>sIcon</td>
	<td>Optional. The icon image to use for this item. In case this item is a folder this
		will be used when the folder is closed.</td>
</tr>
<tr>
	<td>sOpenIcon</td>
	<td>Optional. The icon image to use for this item when it is opened. This is only
		used for folder items that are opened/expanded.</td>
</tr>
</tbody>
</table>

<h3>Properties</h3>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td colspan="2">All properties from <code>WebFXTreeItem</code>.</td>
</tr>
<tr>
	<td>src</td>
	<td>The source to the xml file that decribes the sub trees. Notice that this is
		read-only after the xml file has started to load so any changes done to the
		source are only valid before the loading of the first file.</td>
</tr>
<tr>
	<td>loading</td>
	<td>Read only. A boolean flag which is true if the xml file has started loading and not yet
		finished.</td>
</tr>
<tr>
	<td>loaded</td>
	<td>Read only. A boolean flag which is true if the xml file has been loaded.</td>
</tr>
<tr>
	<td>errorText</td>
	<td>Read only String. If the loading for any reason failed the reason can be found in
		the <code>errorText</code> property. If no error occured this is <code>""</code>
		(an empty string).</td>
</tr>
</tbody>
</table>

<h3>Methods</h3>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td>reload()</td>
	<td>Reloads the XML file from the server and recreates the children of this node.</td>
</tr>
<tr>
	<td colspan="2">All methods from <code>WebFXTree</code>.</td>
</tr>
</tbody>
</table>


<h2>The xml format</h2>

<p>The only valid element in the xml file is the <code>tree</code> item. A <code>tree</code>
item can contain zero, one or more <code>tree</code> items.</p>

<h3>Attributes</h3>

<p>There are five valid attributes that you can provide on a <code>tree</code> item.</p>

<table>
<thead><tr>
	<td>Name</td>
	<td>Description</td>
</tr></thead>
<tbody>
<tr>
	<td>text</td>
	<td>Required. The text label for the tree item.</td>
</tr>
<tr>
	<td>xmlSrc</td>
	<td>Optional. The source for the xml file to load when expanded.</td>
</tr>
<tr>
	<td>action</td>
	<td>Optional. The action (uri) associated with the tree item.</td>
</tr>
<tr>
	<td>icon</td>
	<td>Optional. The icon image to use for this item. In case this item is a folder this
		will be used when the folder is closed.</td>
</tr>
<tr>
	<td>openIcon</td>
	<td>Optional. The icon image to use for this item when it is opened. This is only
		used for folder items that are opened/expanded.</td>
</tr>
</tbody>
</table>

<h3>DTD</h3>

<p>The xml file does not have to be valid to work (only well formed) but if you want to
ensure that you didn't do anything wrong you can use the <a href="tree.dtd">following
document type definition</a>:</p>

<pre>
&lt;!ELEMENT tree (tree*)&gt;
&lt;!ATTLIST tree
          text      CDATA   #REQUIRED
          src       CDATA   #IMPLIED
          action    CDATA   #IMPLIED
          icon      CDATA   #IMPLIED
          openIcon  CDATA   #IMPLIED&gt;
</pre>

<p>To use the dtd in your xml file add a <code>DOCTYPE</code> to the head of your
xml file. Below is <a href="tree.dtd.xml">tree.dtd.xml</a> shown. This
represents the same xml tree as in <a href="tree.xml">tree.xml</a> with a
<code>DOCTYPE</code> declaration.</p>

<pre>
&lt;?xml version="1.0"?&gt;

&lt;!DOCTYPE tree SYSTEM "tree.dtd"&gt;
&lt;tree&gt;
	&lt;tree text="Loaded Item 1" action="href://webfx.eae.net" /&gt;
	&lt;tree text="Loaded Item 2"&gt;
		&lt;tree text="Loaded Item 2.1" action="javascript:alert(2.1)" /&gt;
	&lt;/tree&gt;
	&lt;tree text="Load &amp;quot;tree1.xml&amp;quot;" src="tree1.xml" /&gt;
&lt;/tree&gt;
</pre>

<p>
<a href="xloadtree.html">Introduction</a><br />
<a href="usage.html">Usage</a><br />
<a href="api.html">API</a><br />
<a href="implementation.html">Implementation</a><br />
<a href="demo.html">Demo</a><br />
<a href="http://webfx.eae.net/download/xloadtree111.zip">Download</a>
</p>

<p class="author">Author: Erik Arvidsson</p>

<!-- end webfx-main-body -->
</div>

</body>
</html>
